<?php

class Mail_Notification extends userQueries {
    /*
     * Email Notification for user
     * @company_type = type of notificaton
     *      - 1 (Formalistics)
     *      - 2 (Company_Only)
     * @idType = {company ID} logged on the system
     *
     *
     */

    public function notify_user($type, $company_type, $userID, $user_type) {
        $serverName = $this->curPageURL("serverName");
        $auth = Auth::getAuth('current_user');
        $db = new Database();
        // Get User Information

        $userInfo = $db->query("SELECT *,u.id as userID,
                                   c.email as companyEmail,
                                   u.email as userEmail,
                                   c.id as companyID
                                   FROM tbuser u
                                   LEFT JOIN tbcompany c on u.company_id=c.id
                                   WHERE u.id={$db->escape($userID)}", "row");



        $mail_format .= '<div style="margin: 0px auto; width: 600px;">';
        $mail_format .= '<div style="padding: 5px;">';
        $mail_format .= '<br />';

        //
        //switch ($company_type) {
        //
        //    case "Formalistics":
        //        $mail_format .= '<img src="' . $serverName . '/images/logo/mainLogo.png" width="150" height="60">';
        //        break;
        //
        //    case "Company_Only":
        //        $mail_format .= $this->avatarPic("companyAdmin", $userInfo['companyID'], "150", "45", "Original", "");
        //        break;
        //}
        $mail_format .= "<img src='" . DIR_EXTERNAL_IMG . "layout/1/header.jpg'>";
        // Settings    

        //$mail_format .= '<img src="' . $serverName . '/images/themes/hr_blueline.gif">';
        $mail_format .= '<br /><br />';
        $mail_format .= '<div style="padding: 10px;background-color:#fff;border:1px solid #ddd;width:98%;color: #333;font-size: 13px;font-family: Arial, Helvetica, sans-serif;">';
        $mail_format .= '<div style="text-align: justify;ine-height: 20px;">';


        if ($type == "regCompany") {
            $mail_title = "Thank you for registering an account with Formalistics!";
            $from = "formalistics@gmail.com";
            $from_name = "Administrator";
            $to_title = $userInfo['name'];

            $activation_code = $this->encrypt_decrypt("encrypt", $userID);

            $mail_format .= "<h1 style='color: #206ba4;display: block;font-family: Arial;font-size: 34px;line-height:100%;font-weight: bold;text-align: left;'>Congratulations!</h1> ";
            $mail_format .= '<br />';
            $mail_format .= 'Thank you for registering with <b>Formalistics</b> (' . $userInfo['name'] . ').';
            $mail_format .= '<br /><br />';
            $mail_format .= 'Your Formalistics User Name is <b>' . $userInfo['companyEmail'] . '</b>.';
            $mail_format .= '<br /><br />';
            $mail_format .= 'Please confirm your email address to receive important notifications, messages from your company, and request to approved from time to time.';
            $mail_format .= '<br /><br />';
            $mail_format .= 'To confirm your email address, click here or go to this URL: <br />';

            $mail_format .= '<a href="' . $_SERVER["HTTP_REFERER"] . 'activate_account?m=Regist&a=Activate&id=' . $userID . '" target="_blank">';
            $mail_format .= $_SERVER["HTTP_REFERER"] . 'activate_account?m=Regist&a=Activate&id=' . $userID;
            $mail_format .= '</a>';

            $mail_format .= '<br /><br />';
            $mail_format .= 'Note: Please make sure that the whole URL above is copied into the browser.';
            $mail_format .= '<br /><br />';
            $mail_format .= 'If you have additional questions and/or comments, please visit our website at <a href="http://www.gs3.com.ph/" target="_blank">http://www.gs3.com.ph/</a>';
            $mail_format .= '<br /><br />';

            $mail_format .= 'Sincerely,<br />';
            $mail_format .= 'Formalistics Team <br />';

            $mail_format .= '<br /><br />';
            $mail_format .= '<div style="border-top: 1px solid #CCC;"></div>';
            $mail_format .= '<br /><br />';
            $mail_format .= "<div style='background-color:#e4001b;width:100%;height:35px;'>";
                $mail_format .= "<div style='padding: 7px; text-align: center; color: #fff; font-size: 11px;'>";
                    $mail_format .= "If you believe you have received this notification in error, please delete and disregard.";
                $mail_format .= "</div>";
            $mail_format .= "</div>";
            $mail_format .= '</div>';
        } elseif ($type == "regUser") {
            $mail_title = "Your account was successfully created.";
            $from = $auth['email'];
            $from_name = $auth['display_name'];
            $to_title = $auth['position'];

            $mail_format .= 'Please save this message for future reference.';
            $mail_format .= '<br /><br />';
            $mail_format .= 'Your new <b>Formalistics</b> account was created successfully.';
            $mail_format .= '<br /><br />';

            
            
            $mail_format .= '<ul style="list-style: none;">';
            $mail_format .= '<li>Here are your account details:</li>';
            $mail_format .= '<div style="margin-left: 30px;">';
            $mail_format .= '<table border="1">';
                $mail_format .= '<body>';
                    $mail_format .= '<tr>';
                        $mail_format .= '<td width="100">';
                            $mail_format .= '<b>Display Name:</b>';
                        $mail_format .= '</td>';
                        $mail_format .= '<td>';
                            $mail_format .= $userInfo['display_name'];
                        $mail_format .= '</td>';
                    $mail_format .= '</tr>';
                    $mail_format .= '<tr>';
                        $mail_format .= '<td width="100">';
                            $mail_format .= '<b>Real Name: </b>';
                        $mail_format .= '</td>';
                        $mail_format .= '<td>';
                            $mail_format .= $userInfo['first_name'] . ' ' . $userInfo['last_name'];
                        $mail_format .= '</td>';
                    $mail_format .= '</tr>';
                    $mail_format .= '<tr>';
                        $mail_format .= '<td width="100">';
                            $mail_format .= '<b>Email: </b>';
                        $mail_format .= '</td>';
                        $mail_format .= '<td>';
                            $mail_format .= $userInfo['userEmail'];
                        $mail_format .= '</td>';
                    $mail_format .= '</tr>';
                    $mail_format .= '<tr>';
                        $mail_format .= '<td width="100">';
                            $mail_format .= '<b>Password:</b>';
                        $mail_format .= '</td>';
                        $mail_format .= '<td>';
                            $mail_format .= $this->encrypt_decrypt("decrypt", $userInfo['password']);
                        $mail_format .= '</td>';
                    $mail_format .= '</tr>';
                    $mail_format .= '<tr>';
                        $mail_format .= '<td width="100">';
                            $mail_format .= '<b>Position:</b>';
                        $mail_format .= '</td>';
                        $mail_format .= '<td>';
                            $mail_format .= $userInfo['position'];
                        $mail_format .= '</td>';
                    $mail_format .= '</tr>';
                $mail_format .= '</body>';
            $mail_format .= '</table>';
            $mail_format .= '</div>';
            //$mail_format .= '</div>';
            $mail_format .= '</ul>';
        }

        $mail_format .= '</div>';
        $mail_format .= '<br />';
        $mail_format .= '</div>';
        $mail_format .= '</div>';

        //return $mail_format;
        $to = array($userInfo['userEmail'] => $userInfo['display_name']);
        $this->sendEmail_smtp($mail_format, $to, "", "", $from, $to_title, $from_name, $mail_title);
    }

    public function workflow_notify_user($mail_info) {
        $date = functions::dateType();
        $to = $mail_info['To'];
        $cc = $mail_info['CC'];
        $bcc = $mail_info['BCC'];
        $from = $mail_info['From'];
        $title = $mail_info['Title'];
        $from_title = $mail_info['From_Title'];
        $body = $mail_info['Body'];
        $company_id = $mail_info['Company_Id'];
        $trackingNo = $mail_info['TrackNo'];
        $formID = $mail_info['Form_Id'];
        $requestID = $mail_info['Request_Id'];
        $requestor_name = $mail_info['Requestor_name'];
        $processor_name = $mail_info['Processor_name'];
        $salutation = array();
        foreach ($to as $value) {
            array_push($salutation, $value);
        }
            

        $path = $this->curPageURL('port') . "/index?type=go&redirect=workspace?view_type=request|=%=|formID=" . $formID . "|=%=|requestID=" . $requestID . "|=%=|trackNo=" . $trackingNo;

        $mail_format .= "<div style='margin:0px auto; width:600px;'>";
        $mail_format .= "<div style='float:left;width:100%;padding:5px;'>";
        $mail_format .= "<div style='float:left;width:100%;'>";
        
        $mail_format .= "<img src='" . DIR_EXTERNAL_IMG . "layout/1/header.jpg'>";
        //$mail_format .= $this->avatarPic("companyAdmin", $company_id, "130", "80", "large", "");

        $mail_format .= "</div>";
        $mail_format .= "</div>";
        $mail_format .= "<div style='float:left;height:50px;width:100%;text-align:right;'>";
        
        $mail_format .= "<p style='color: #505050;font-family: Arial;font-size: 10px;margin-top: 10px;'>" . $date . "</p>";
        //$mail_format .= $this->avatarPic("companyAdmin", $company_id, "130", "80", "large", "");

        $mail_format .= "</div>";
        $mail_format .= "<div style='float:left;width:100%;margin-bottom: 30px;font-size:11px;background-color:#fff;border:1px solid #ddd;'>";
        $mail_format .= "<div style='padding:20px;color: #222222; font-family: Arial; font-size: 14px;line-height: 150%;'>";
        //$mail_format .= "<h1 style='color: #206ba4;display: block;font-family: Arial;font-size: 34px;font-weight: bold;line-height: 100%;text-align: left;'>Greetings!</h1>  <br>";
        $mail_format .= "This message was sent from <b>FORMALISTICS</b>.<br><br>";
        //$mail_format .= "This is to inform you that a request from <b>" . $requestor_name . "</b> has been processed and requires your immediate action.<br><br>";
        $mail_format .= "<b>" . $requestor_name . "</b> sent a request and <br>";
        if ($body && $body != 'null' && $body != '') {
            //mail message
            //$mail_format .= "<div style='float:left;width:100%;font-size:11px;'>";
            $mail_format .= $body . "<br><br>";
            //$mail_format .= "</div>";
        }
        $mail_format .= "Please refer to this link:<br>";
        $mail_format .= "<a href='" . $path . "' target='_blank'>Click Here</a><br> <br>";
        //$mail_format .= "Sincerely,<br>";
        //$mail_format .= "Formalistics Team<br><br>";
        //$mail_format .= "<div style='background-color:#e4001b;width:100%;height:35px;'>";
        //    $mail_format .= "<div style='padding: 7px; text-align: center; color: #fff; font-size: 11px;'>";
        //        $mail_format .= "If you believe you have received this notification in error, please delete and disregard.";
        //    $mail_format .= "</div>";
        //$mail_format .= "</div>";
        $mail_format .= "</div>";
        
        $mail_format .= "</div>";
        //$mail_format .= "<div style='float:left;background-color:#1f1f1f;width:100%;height: 62px;'>";
        //    $mail_format .= "<div style='padding: 12px; text-align: center; color: #fff; font-size: 11px;'>";
        //        $mail_format .= "Copyright @ 2014 All rights reserved. <br> Formalistics";
        //    $mail_format .= "</div>";
        //$mail_format .= "</div>";
        $mail_format .= "</div>";
        //$mail_format .= "This message was sent from <b>FORMALISITCS</b>.<br><br>";

        //if ($body && $body != 'null' && $body != '') {
        //    //mail message
        //    $mail_format .= "<div style='float:left;width:100%;font-size:11px;'>";
        //    $mail_format .= $body . "<br> <br>";
        //    $mail_format .= "</div>";
        //}

        //mail link
        
        //$mail_format .= "<div style='float:left;width:100%;font-size:11px;'>";
        //$mail_format .= "To view the request, browse to Formalistics Tracker (" . DIR_EXTERNAL_IMG . "):<br>";
        //
        //$mail_format .= "<a href='" . $path . "' target='_blank'>" . $path . "</a><br> <br>";
        //$mail_format .= "</div>";
        //
        //$mail_format .= "<div style='float:left;width:100%;font-size:11px;'>";
        //$mail_format .= "<br> <br>***********************************************************************************<br>" .
        //        "Please do not reply to this message. This is highly confidential. If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you are not the intended recipient or you received this by mistake, please delete it and all copies from your system." .
        //        "<br>************************************************************************************";
        //$mail_format .= "</div>";
        //$mail_format .= "</div>";
        //echo print_r($to)
        
        $this->sendEmail_smtp($mail_format, $to, $cc, $bcc, $from, "", $from_title, $title);
    }
    
    public function recover_password($to,$to_title,$companyID,$password,$id){
        $serverName = $this->curPageURL("serverName");
        $mail_title = "Your password was successfully reset.";
        $from = "formalistics@gmail.com";
        $from_name = "Administrator";
        
        
        $mail_format .= '<div style="margin: 0px auto; width: 580px;">';
        $mail_format .= '<div style="padding: 5px;">';
        $mail_format .= '<br />';
        
        //$mail_format .= $this->avatarPic("companyAdmin", $companyID, "150", "45", "Original", "");
        //
        //$mail_format .= '<img src="' . $serverName . '/images/themes/hr_blueline.gif">';
        $mail_format .= "<img src='" . DIR_EXTERNAL_IMG . "layout/1/header.jpg'>";
        $mail_format .= '<br /><br />';
        $mail_format .= '<div style="padding: 10px;color: #333;font-size: 13px;font-family: Arial, Helvetica, sans-serif;">';
        $mail_format .= '<div style="text-align: justify;ine-height: 20px;">';
        

        $mail_format .= 'Please save this message for future reference.';
        $mail_format .= '<br /><br />';
        $mail_format .= 'Your new <b>Formalistics</b> password was successfully reset.';
        $mail_format .= '<br /><br />';

        $mail_format .= '<ul style="list-style: none;">';
        $mail_format .= '<li>Here are your account details:</li>';
        $mail_format .= '<div style="margin-left: 30px;">';
        $mail_format .= '<li><b>Link:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="'.$serverName.'/reset_password?id='. $id .'" target="blank">' . $serverName . '/reset_password?id='. $id .'</a></li>';
        $mail_format .= '<li><b>Your new password: </b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' . $password . '</li>';
        $mail_format .= '</div>';
        $mail_format .= '</ul>';
            
        
        $mail_format .= '</div>';
        $mail_format .= '<br />';
        $mail_format .= '</div>';
        $mail_format .= '</div>';
        //return $mail_format;
        $this->sendEmail_smtp($mail_format, $to, "", "", $from, $to_title, $from_name, $mail_title);
    }
    
    public function set_notifications($to,$msg,$img,$uID,$name,$msg_type,$f_name,$type,$t,$path) {
        $date = functions::dateType();
        $from = "formalistics@gmail.com";
        $from_name = "Administrator";
        
        
        $mail_format .= "<div style='margin:0px auto; width:600px;'>";
        $mail_format .= "<div style='float:left;width:100%;padding:5px;'>";
        $mail_format .= "<div style='float:left;width:100%;'>";
        
        $mail_format .= "<img src='" . DIR_EXTERNAL_IMG . "layout/1/header.jpg'>";
        //$mail_format .= $this->avatarPic("companyAdmin", $company_id, "130", "80", "large", "");

        $mail_format .= "</div>";
        $mail_format .= "</div>";
        $mail_format .= "<div style='float:left;height:50px;width:100%;text-align:right;'>";
        
        $mail_format .= "<p style='color: #505050;font-family: Arial;font-size: 10px;margin-top: 10px;'>" . $date . "</p>";
        //$mail_format .= $this->avatarPic("companyAdmin", $company_id, "130", "80", "large", "");

        $mail_format .= "</div>";
        $mail_format .= "<div style='float:left;width:100%;font-size:11px;background-color:#fff;border:1px solid #ddd;'>";
        $mail_format .= "<div style='padding:20px;color: #222222; font-family: Arial; font-size: 14px;line-height: 150%;'>";
        //$mail_format .= "<h1 style='color: #206ba4;display: block;font-family: Arial;font-size: 20px;font-weight: bold;line-height: 100%;text-align: left;'>";
        $mail_format .= '<div style="float:left;width:100%;margin-bottom: 40px;">';
            $mail_format .= $img;
            $mail_format .= '<div style="float:left;margin-top: 25px;margin-right: 5px;color: #206ba4;display: block;font-family: Arial;font-size: 15px;font-weight: bold;line-height: 100%;text-align: left;">' . $name . '</div>';
            $mail_format .= '<div style="float:left;margin-top: 25px;margin-right: 5px;color: #000;display: block;font-family: Arial;font-size: 15px;font-weight: bold;line-height: 100%;text-align: left;">' . $msg_type .'.</div>';
        $mail_format .= '</div>';
            //$mail_format .= "<img style='border-radius:50px;' src='http://eforms.gs3.com.ph/images/formalistics/tbuser/c6b20bcb93196b3f5c1913dc92e583d2/small_c6b20bcb93196b3f5c1913dc92e583d2.png'>";
        //$mail_format .= "Cez Diane!</h1>  <br>";
        
        
        
        $mail_format .= "<label style='font-size:12px;'>" . $f_name . "'s " . $t . ": '" . $msg . "'</label><br><br>";
        
        
        $mail_format .= "<a href='" . $path . "' target='_blank'>";
        $mail_format .= "<div style='float:left;background-color:#e4001b;width:30%;height:35px;margin-right:10px;margin-bottom: 30px;margin-top:5px;'>";
            $mail_format .= "<div style='cursor:pointer;font-weight:bold;padding: 7px; text-align: center; color: #fff; font-size: 11px;'>";
                $mail_format .= "See " . $type;
            $mail_format .= "</div>";
        $mail_format .= "</div>";
        $mail_format .= "</a>";
        
        
        $mail_format .= "<br><br>";
        
        $mail_format .= "</div>";
        
        $mail_format .= "</div>";
        $mail_format .= "<div style='float:left;background-color:#1f1f1f;width:100%;height: 62px;margin-top:10px;'>";
            $mail_format .= "<div style='padding: 12px; text-align: center; color: #fff; font-size: 11px;'>";
                $mail_format .= "Copyright @ 2014 All rights reserved. <br> Formalistics";
            $mail_format .= "</div>";
        $mail_format .= "</div>";
        $mail_format .= "</div>";
        //return $mail_format;
        $this->sendEmail_smtp($mail_format, $to, "", "", $from, "Administrator", $from_title, "Formalistics");
    }
    
    
    public function email_prompt_notifications($to,$name,$array,$noti) {
	$serverName = $this->curPageURL("serverName");
        $date = functions::dateType();
        if(ALLOW_USER_VIEW=="1"){
            if($noti['user_level_id'] == "2" || $noti['user_level_id'] == "1"){
                $link = $this->curPageURL('port') . "/notifications";
            }else if($noti['user_level_id'] == "3"){
                $link = $this->curPageURL('port') . USER_VIEW . "notifications";
            }
        }else{
            $link = $this->curPageURL('port') . "/notifications";
        }
        
        $mail_format .= "<div style='margin:0px auto; width:600px;'>";
        $mail_format .= "<div style='float:left;width:100%;padding:5px;'>";
        $mail_format .= "<div style='float:left;width:100%;'>";
        
        $mail_format .= "<img src='" . DIR_EXTERNAL_IMG . "layout/1/header.jpg'>";
        //$mail_format .= $this->avatarPic("companyAdmin", $company_id, "130", "80", "large", "");

        $mail_format .= "</div>";
        $mail_format .= "</div>";
        $mail_format .= "<div style='float:left;height:50px;width:100%;text-align:right;'>";
        
        $mail_format .= "<p style='color: #505050;font-family: Arial;font-size: 10px;margin-top: 10px;'>" . $date . "</p>";
        //$mail_format .= $this->avatarPic("companyAdmin", $company_id, "130", "80", "large", "");

        $mail_format .= "</div>";
        $mail_format .= "<div style='float:left;width:100%;margin-bottom: 30px;font-size:11px;background-color:#fff;border:1px solid #ddd;'>";
        $mail_format .= "<div style='padding:20px;color: #222222; font-family: Arial; font-size: 14px;line-height: 150%;'>";
        //$mail_format .= "<h1 style='color: #206ba4;display: block;font-family: Arial;font-size: 20px;font-weight: bold;line-height: 100%;text-align: left;'>";
        $mail_format .= '<div style="float:left;width:100%;margin-bottom: 40px;">';
            $mail_format .= '<div style="float:left;margin-top: 22px;margin-right: 5px;color: #206ba4;display: block;font-family: Arial;font-size: 22px;font-weight: bold;line-height: 100%;text-align: left;">Hello</div>';
            //$mail_format .=  $noti['img'];
            $mail_format .= '<div style="float:left;margin-top: 22px;margin-right: 5px;color: #206ba4;display: block;font-family: Arial;font-size: 22px;font-weight: bold;line-height: 100%;text-align: left;">' . $name . '</div>';
        $mail_format .= '</div>';
            //$mail_format .= "<img style='border-radius:50px;' src='http://eforms.gs3.com.ph/images/formalistics/tbuser/c6b20bcb93196b3f5c1913dc92e583d2/small_c6b20bcb93196b3f5c1913dc92e583d2.png'>";
        //$mail_format .= "Cez Diane!</h1>  <br>";
        
        $mail_format .= "<font color='#e4001b' style='font-weight:bold;'>You have new notifications! </font>.<br><br>";
        $mail_format .= "A lot has happened on Formalistics since you last logged in. Here are some notifications you've missed.<br><br>";
        
        $mail_format .= "<div style='float:left;width:100%;'>";
                //$mail_format .= "<div style='float:left;width:100%;margin-top:5px;'><img style='float:left;' src='". DIR_EXTERNAL_IMG ."Notifications_icon/1/annoucnement-icon.png'> <div style='float:left;color:#206ba4;margin-left:5px;'><b>3</b> people commented on your post</div> </div><br>";
            if($noti['Tadded'] != "0"){
                $mail_format .= "<div style='float:left;width:100%;margin-top:5px;'><img style='float:left;' src='". DIR_EXTERNAL_IMG ."Notifications_icon/1/events-icon.png'> <div style='float:left;color:#206ba4;margin-left:5px;'><b>". $noti['Tadded'] ."</b> Task added you as a team.</div> </div><br>";
            }
            
            if($noti['Tview'] != "0"){
                $mail_format .= "<div style='float:left;width:100%;margin-top:5px;'><img style='float:left;' src='". DIR_EXTERNAL_IMG ."Notifications_icon/1/events-icon.png'> <div style='float:left;color:#206ba4;margin-left:5px;'><b>". $noti['Tview'] ."</b> Task set you as an editor.</div> </div><br>";
            }
            
            if($noti['Tedit'] != "0"){
                $mail_format .= "<div style='float:left;width:100%;margin-top:5px;'><img style='float:left;' src='". DIR_EXTERNAL_IMG ."Notifications_icon/1/events-icon.png'> <div style='float:left;color:#206ba4;margin-left:5px;'><b>". $noti['Tedit'] ."</b> Task set you as a viewer.</div> </div><br>";
            }
            
            if($noti['Tdue'] != "0"){
                $mail_format .= "<div style='float:left;width:100%;margin-top:5px;'><img style='float:left;' src='". DIR_EXTERNAL_IMG ."Notifications_icon/1/events-icon.png'> <div style='float:left;color:#206ba4;margin-left:5px;'><b>". $noti['Tdue'] ."</b> Task was not able to complete on its due date.</div> </div><br>";
            }
            
            if($noti['Msg'] != "0"){
                $mail_format .= "<div style='float:left;width:100%;margin-top:5px;'><img style='float:left;' src='". DIR_EXTERNAL_IMG ."Notifications_icon/1/msgspecific-icon.png'> <div style='float:left;color:#206ba4;margin-left:5px;'><b>". $noti['Msg'] ."</b> Unread message was not unable to view.</div> </div><br>";
            }
            
            if($noti['Lpost'] != "0"){
                $mail_format .= "<div style='float:left;width:100%;margin-top:5px;'><i class='icon-thumbs-up'></i> <div style='float:left;color:#206ba4;margin-left:5px;'><b>". $noti['Lpost'] ."</b> Like's on post.</div> </div><br>";
            }
            
            if($noti['Lcomment'] != "0"){
                $mail_format .= "<div style='float:left;width:100%;margin-top:5px;'><i class='icon-thumbs-up'></i> <div style='float:left;color:#206ba4;margin-left:5px;'><b>". $noti['Lcomment'] ."</b> Like's on comment.</div> </div><br>";
            }
            
            if($noti['request'] != "0"){
                $mail_format .= "<div style='float:left;width:100%;margin-top:5px;'><i class='icon-file'></i> <div style='float:left;color:#206ba4;margin-left:5px;'>You have <b>". $noti['request'] ."</b> request.</div> </div><br>";
            }
              
        $mail_format .= "</div>";
        
        $mail_format .= "<a href='" . $link . "' target='_blank'>";
        $mail_format .= "<div style='float:left;background-color:#e4001b;width:48%;height:35px;margin-right:10px;margin-bottom: 10px;margin-top:50px;'>";
            $mail_format .= "<div style='font-weight:bold;padding: 7px; text-align: center; color: #fff; font-size: 11px;'>";
                $mail_format .= "View all notifications";
            $mail_format .= "</div>";
        $mail_format .= "</div>";
        $mail_format .= "</a>";
        
        $mail_format .= "<a href='" . $this->curPageURL('port') . "' target='_blank'>";
        $mail_format .= "<div style='float:left;background-color:#ff7200;width:48%;height:35px;margin-left:10px;margin-bottom: 10px;margin-top:50px;'>";
            $mail_format .= "<div style='font-weight:bold;padding: 7px; text-align: center; color: #fff; font-size: 11px;'>";
                $mail_format .= "Go to formalistics";
            $mail_format .= "</div>";
        $mail_format .= "</div>";
        $mail_format .= "<br><br>";
        $mail_format .= "</a>";
        
        $mail_format .= "</div>";
        
        $mail_format .= "</div>";
        $mail_format .= "<div style='float:left;background-color:#1f1f1f;width:100%;height: 62px;'>";
            $mail_format .= "<div style='padding: 12px; text-align: center; color: #fff; font-size: 11px;'>";
                $mail_format .= "Copyright @ 2014 All rights reserved. <br> Formalistics";
            $mail_format .= "</div>";
        $mail_format .= "</div>";
        $mail_format .= "</div>";
        //return $mail_format;
        $from = "jeweljeimstolentino@gmail.com";
		//$from = array();
        $from_title = "Notifications";
        $title = "Formalistics Notifications";
		
		//print_r($to);
        $this->sendEmail_smtp($mail_format, $to, "", "", $from, "", $from_title, $title);
    }
}

?>